package com.artpri.action.goods;

import java.util.List;
import java.util.Map;

import com.artpri.action.BaseAction;
import com.artpri.model.Goods;
import com.artpri.model.GoodsComment;
import com.artpri.model.GoodsCommentR;
import com.artpri.model.vo.GoodsAttrVo;

/**
 * 商品详细 
 * @author ZhangSi
 */
public class GoodsDetailAction extends BaseAction{

	private static final long serialVersionUID = 5022301906796850380L;
	
	private Integer id;
	
	private Integer gcgId;
	
	private Goods goods;
	
	private List<String> picUrls;
	
	private List<GoodsAttrVo> goodsAttrs;
	
	private Map<GoodsComment, List<GoodsCommentR>> goodsComment;
	
	@Override
	public String execute() throws Exception {
		
		//1. 获取商品信息
		goods = getGoodsService().get(id);
		//2. 获取商品图片url
		picUrls = getGoodsAlbumService().getAlbumUrlsByGoods(id);
		//3. 获取规格属性
		goodsAttrs = getGoodsAttrService().getGoodsAttrByGoods(id);
		//4. 获取商品评论信息
		goodsComment = getGoodsCommentService().getGoodsCommentByGoods(id);
		//5. gcgId;
		gcgId = getGoodsCategoryService().getGroupByCategory(goods.getGcId()).getGcgId();
		return SUCCESS;
	}

	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	public List<GoodsAttrVo> getGoodsAttrs() {
		return goodsAttrs;
	}

	public void setGoodsAttrs(List<GoodsAttrVo> goodsAttrs) {
		this.goodsAttrs = goodsAttrs;
	}

	public Map<GoodsComment, List<GoodsCommentR>> getGoodsComment() {
		return goodsComment;
	}

	public void setGoodsComment(Map<GoodsComment, List<GoodsCommentR>> goodsComment) {
		this.goodsComment = goodsComment;
	}

	public List<String> getPicUrls() {
		return picUrls;
	}
	public void setPicUrls(List<String> picUrls) {
		this.picUrls = picUrls;
	}
	public Integer getGcgId() {
		return gcgId;
	}
	public void setGcgId(Integer gcgId) {
		this.gcgId = gcgId;
	}
}
